package com.dataart.training.crimequalification.beans;

import com.dataart.training.crimequalification.entity.*;
import com.dataart.training.crimequalification.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import java.util.List;

@Component
@ManagedBean
@Scope("request")
public class DomainContentsBean {

    //---------------------------------------------------------------

    @Autowired
    private CrimeObjectService crimeObjectService;

    @Autowired
    private CrimeSubjectService crimeSubjectService;

    @Autowired
    private CrimeConsequenceService crimeConsequenceService;

    @Autowired
    private SubjectiveSideService subjectiveSideService;

    @Autowired
    private ObjectiveSideService objectiveSideService;

    //---------------------------------------------------------------

    private List<MainCrimeObjectEntity> mainCrimeObjects;
    private List<FacultativeCrimeObjectEntity> facultativeCrimeObjects;
    private List<SupplementaryCrimeObjectEntity> supplementaryCrimeObjects;

    private List<CrimeSubjectEntity> crimeSubjects;

    private List<CrimeConsequenceEntity> crimeConsequences;

    private List<IntentEntity> intents;
    private List<IndiscretionEntity> indiscretions;
    private List<MotiveEntity> motives;
    private List<PurposeEntity> purposes;
    private List<DelinquentStateEntity> delinquentStates;

    private List<CriminalActEntity> criminalActs;
    private List<ActFeatureEntity> actFeatures;

    //---------------------------------------------------------------

    @PostConstruct
    private void init() {

        mainCrimeObjects = crimeObjectService.getAllMainCrimeObjects();
        facultativeCrimeObjects = crimeObjectService.getAllFacultativeCrimeObjects();
        supplementaryCrimeObjects = crimeObjectService.getAllSupplementaryCrimeObjects();

        crimeSubjects = crimeSubjectService.getAllCrimeSubjects();

        crimeConsequences = crimeConsequenceService.getAllCrimeConsequences();

        intents = subjectiveSideService.getAllIntents();
        indiscretions = subjectiveSideService.getAllIndiscretionTypes();
        motives = subjectiveSideService.getAllMotives();
        purposes = subjectiveSideService.getAllPurposes();
        delinquentStates = subjectiveSideService.getAllDelinquentStates();

        criminalActs = objectiveSideService.getAllCriminalActs();
        actFeatures = objectiveSideService.getAllActFeatures();

    }

    //---------------------------------------------------------------

    public List<MainCrimeObjectEntity> getMainCrimeObjects() {
        return mainCrimeObjects;
    }

    public void setMainCrimeObjects(List<MainCrimeObjectEntity> mainCrimeObjects) {
        this.mainCrimeObjects = mainCrimeObjects;
    }

    public List<FacultativeCrimeObjectEntity> getFacultativeCrimeObjects() {
        return facultativeCrimeObjects;
    }

    public void setFacultativeCrimeObjects(List<FacultativeCrimeObjectEntity> facultativeCrimeObjects) {
        this.facultativeCrimeObjects = facultativeCrimeObjects;
    }

    public List<SupplementaryCrimeObjectEntity> getSupplementaryCrimeObjects() {
        return supplementaryCrimeObjects;
    }

    public void setSupplementaryCrimeObjects(List<SupplementaryCrimeObjectEntity> supplementaryCrimeObjects) {
        this.supplementaryCrimeObjects = supplementaryCrimeObjects;
    }

    public List<CrimeSubjectEntity> getCrimeSubjects() {
        return crimeSubjects;
    }

    public void setCrimeSubjects(List<CrimeSubjectEntity> crimeSubjects) {
        this.crimeSubjects = crimeSubjects;
    }

    public List<CrimeConsequenceEntity> getCrimeConsequences() {
        return crimeConsequences;
    }

    public void setCrimeConsequences(List<CrimeConsequenceEntity> crimeConsequences) {
        this.crimeConsequences = crimeConsequences;
    }

    public List<IntentEntity> getIntents() {
        return intents;
    }

    public void setIntents(List<IntentEntity> intents) {
        this.intents = intents;
    }

    public List<IndiscretionEntity> getIndiscretions() {
        return indiscretions;
    }

    public void setIndiscretions(List<IndiscretionEntity> indiscretions) {
        this.indiscretions = indiscretions;
    }

    public List<MotiveEntity> getMotives() {
        return motives;
    }

    public void setMotives(List<MotiveEntity> motives) {
        this.motives = motives;
    }

    public List<PurposeEntity> getPurposes() {
        return purposes;
    }

    public void setPurposes(List<PurposeEntity> purposes) {
        this.purposes = purposes;
    }

    public List<DelinquentStateEntity> getDelinquentStates() {
        return delinquentStates;
    }

    public void setDelinquentStates(List<DelinquentStateEntity> delinquentStates) {
        this.delinquentStates = delinquentStates;
    }

    public List<CriminalActEntity> getCriminalActs() {
        return criminalActs;
    }

    public void setCriminalActs(List<CriminalActEntity> criminalActs) {
        this.criminalActs = criminalActs;
    }

    public List<ActFeatureEntity> getActFeatures() {
        return actFeatures;
    }

    public void setActFeatures(List<ActFeatureEntity> actFeatures) {
        this.actFeatures = actFeatures;
    }
}
